package com.ximcontroller.views;


import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;

import com.lumivi.game.XIMSimpleExperimenter;

import processing.core.PApplet;
import processing.core.PShape;
//import processing.video.Movie;

public class XIMFloor {

	XIMSimpleExperimenter p;
	PShape imgTile;

	XIMTile[] tiles;
	int numTiles = 73;

	//Movie myMovie;

	public XIMFloor(XIMSimpleExperimenter p) {
		this.p = p;
		imgTile = p.loadShape("./ximfloor.svg");

		//myMovie = new Movie(p, "./test.mov");
		//myMovie.loop();

		initialize();
	}

	public void initialize() {
		this.tiles = new XIMTile[numTiles];

		for (int i = 1; i < numTiles; i++) {
			tiles[i] = new XIMTile(p, imgTile, i);
		}

	}

	public void calculate() {

	}

	public void render() {

		p.pushMatrix();
		p.translate(205, 0);
		p.scale((float) 0.5);

		for (int i = 1; i < numTiles; i++) {
			//tiles[i].setColor(p.getWsc().);
			tiles[i].render();
		}

		p.popMatrix();

	} 
	
	

	

	// experimental video loader
	//public void loadVideo() {
    //
	//}

	//public void renderVideo() {
	//	if (myMovie.available()) {
	//		// image(myMovie, 100, 1);
	//	}
    //
	//}

	//void movieEvent(Movie myMovie) {
	//	myMovie.read();
    //
	//}

}
